import pymysql
connector = pymysql.connect(host='localhost',user='root',password='root',port=3306)

cursor = connector.cursor()

cursor.execute('SELECT VERSION()')

data = cursor.fetchone()

print('database version:',data)

cursor.execute("CREATE DATABASE test DEFAULT CHARACTER SET utf8mb4")

connector.close()